package com.theaf.basemodule.common.model.mesTemplate;

import com.theaf.core.annotation.FieldCn;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;

@ApiModel("消息模版")
@Entity
@Table(name = "mes_template")
@Data
@AllArgsConstructor
@NoArgsConstructor
@DynamicUpdate
@DynamicInsert
public class MesTemplate {
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "user_id_req")
    @SequenceGenerator(name = "user_id_req", sequenceName = "sys_req")
    @FieldCn(value = "id")
    private Long id;
    @Column(name = "type")
    @FieldCn(value = "分类", note = "1业务通知 2异常通知")
    private Integer type;
    @Column(name = "name")
    @FieldCn(value = "模版名称")
    private String name;
    @Column(name = "code")
    @FieldCn(value = "模版编码")
    private String code;
    @Column(name = "status")
    @FieldCn(value = "状态", note = "1启用2禁用")
    private Integer status;
    @Column(name = "create_time")
    @FieldCn(value = "创建时间")
    private Timestamp createTime;
    @Column(name = "create_user")
    @FieldCn(value = "创建人")
    private String creater;
    @Column(name = "update_time")
    @FieldCn(value = "修改时间")
    private Timestamp updateTime;
    @Column(name = "update_user")
    @FieldCn(value = "修改人")
    private String updater;
    @Column(name = "remark")
    @FieldCn(value = "备注")
    private String remark;
    @Column(name = "cron")
    @FieldCn(value = "周期表达式")
    private String cron;
    @OneToMany(cascade={CascadeType.ALL})
    @JoinColumn(name="template_id")
    private List<MesNotifyScope> mesNotifyScopeList;
    @OneToMany(cascade={CascadeType.ALL})
    @JoinColumn(name="template_id")
    private List<MesTemplateWay> mesTemplateWayList;
}
